package com.marketingManagement.controller;

import com.eight.pojo.TbCustomerIssues;
import com.eight.pojo.TbMaintainRecord;
import com.eight.vo.ComResult;
import com.marketingManagement.service.impl.customerIssuesServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.time.LocalDateTime;

/**
 * @author caoch
 * @since 2023/2/28 17:07
 **/
@RestController
@RequestMapping("/marketingManagement")
public class customerIssuesController {
	@Autowired
	private customerIssuesServiceImpl customerIssuesService;
	@RequestMapping("addCustomerIssues")
	public ComResult addCustomerIssues(@RequestBody TbCustomerIssues customerIssues) {
		customerIssues.setAddtime((LocalDateTime.now()));
		return new ComResult(2000,"success",customerIssuesService.addCustomerIssues(customerIssues));
	}
	@RequestMapping("updateCustomerIssues")
	public ComResult updateCustomerIssues(@RequestBody TbCustomerIssues customerIssues) {
		return new ComResult(2000,"success",customerIssuesService.updateCustomerIssues(customerIssues));
	}
	@RequestMapping("removeCustomerIssues/{id}")
	public ComResult removeCustomerIssues(@PathVariable int id) {
		return new ComResult(2000,"success",customerIssuesService.removeCustomerIssues(id));
	}
	@RequestMapping("selectCustomerIssues")
	public ComResult selectCustomerIssues(@RequestParam(defaultValue = "1")Integer currentPage,
	                              @RequestParam(defaultValue = "5")Integer pageSize,
	                              @RequestBody TbCustomerIssues customerIssues ) {
		return new ComResult(2000,"success",customerIssuesService.selectCustomerIssues(currentPage,pageSize,customerIssues));
	}
}
